<?php
//连接数据库
include('connect.php');
//拿到请求数据
$username = $_POST['username'];
$pwd = $_POST['pwd'];
//写sql语句
$sql = "SELECT * FROM `bbs_users` WHERE `username` = '$username'";
//执行sql语句
$res = mysqli_query($link,$sql);
//解析结果集
$row = mysqli_fetch_assoc($res);
//判断用户名是否存在
if(!$row){
    $arr = ['status'=>0,'msg'=>'用户名不存在'];
}else{
    if($row['password'] == $pwd){
        $arr = ['status'=>1,'msg'=>'登录成功'];
    }else{
        $arr = ['status'=>0,'msg'=>'用户名或者密码错误'];
    }
}
echo json_encode($arr);
?>